import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/layout'

Vue.use(Router)
const router = new Router({
  // mode: 'history', // 去掉url中的#
  routes: [
    {
      path: '/',
      component: Layout,
      redirect: '/index',
      children: [
        {
          path: 'index',
          component: () => import('@/views/index'),
          name: 'Dashboard',
          meta: { title: '首页 | 小熊代码生成' }
        }
      ]
    },
    {
      path: '/generate/',
      component: Layout,
      redirect: '/index',
      children: [
        {
          path: 'index',
          component: () => import('@/views/gen-index'),
          name: 'Gen',
          meta: { title: '代码生成 | 小熊代码生成' }
        }
      ]
    },
    {
      path: '/export/',
      component: Layout,
      redirect: '/index',
      children: [
        {
          path: 'index',
          component: () => import('@/views/export/index'),
          name: 'Gen',
          meta: { title: '代码生成 | 小熊代码生成' }
        }
      ]
    },
    {
      path: '/gen-edit',
      component: Layout,
      redirect: '/index',
      children: [
        {
          path: '',
          component: () => import('@/views/editTable'),
          // component: (resolve) => require(['@/views/editTable'], resolve),
          name: 'GenEdit',
          meta: { title: '修改生成配置 | 小熊代码生成'}
        }
      ]
    }
  ]
})

export { router }
